//
//  TCoreAnimationViewController.m
//  TCoreAnimation
//
//  Created by Louis CHU on 09/09/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "TCoreAnimationViewController.h"

#define distancef(point1,point2)      (sqrtf((point1.x-point2.x)*(point1.x-point2.x) + (point1.y-point2.y)*(point1.y-point2.y)))

@interface TCoreAnimationViewController ()



@end

@implementation TCoreAnimationViewController 
@synthesize vehiculeView;


- (void)dealloc
{
    self.vehiculeView = nil;
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    
}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - animation



#pragma mark - touchs
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"touchesBegan");
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"touchesMoved");

}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"touchesEnded");
    UITouch * touch = [touches anyObject];
    CGPoint location = [touch locationInView:self.view];
    NSLog(@"location %f %f",location.x,location.y);
    
    //[self  moveTo:location];
    [self.vehiculeView moveTo:location];

}

- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"touchesCancelled");

}

@end
